$(function(){
	var $liList = $('#pageLinkDiv a');
	var skipList = {
			'indexPageBtn' : 1
			,'lastPageBtn' : page.start == 1 ? 1 : page.start - 1
			,'nextPageBtn' : page.start + 1 >= page.pageCount ? page.pageCount : page.start + 1
			,'endPageBtn' : page.pageCount
	}
	$.each($liList, function(i, o){
		if(o.id && o.id != ''){
			$(o).bind('click', function(){
				page.skipPage(skipList[o.id]);
			});
		}else{
			$(o).bind('click', function(){
				page.skipPage($(o).text());
			});
		}
	});
});

var page = {
		'pageCount' : 1
		,'start' : 1
};

page.skipPage = function(page){
	var $form = $('#pageForm');
	if($form.find('input[name="start"]').length==0){
		$form.html($form.html() + '<input type="hidden" name="start" value="' + page + '" />');
		$form.submit();
		return false;
	}

}